package file;


import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class demo7 {
    public static void main(String[] args) throws IOException {
        try (InputStream inputStream = new FileInputStream("E:/桌面/代码库/java-ee/file/src/text.txt")) {
            while (true){
                byte[]buf = new byte[1024];
                int n =inputStream.read(buf);
                if(n==-1){
                    break;
                }
                for (int i = 0; i <n ; i++) {
                    System.out.printf("%x ",buf[i]);
                }
                String s = new String(buf,0,n);
                System.out.println(s);
            }
        }
    }
}
